﻿using System;
using Newtonsoft.Json;
using Sportsbook.CouchbasePersistence.Models.Lines;
using Sportsbook.Domain.Models.Lines;

namespace Sportsbook.CouchbasePersistence.JsonConverters.Lines
{
    public class MoneylineConverter : JsonConverter
    {
        public override bool CanConvert(Type objectType)
        {
            return (objectType == typeof(IMoneyline));
        }

        public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
        {
            return serializer.Deserialize<Moneyline>(reader);
        }

        public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
        {
            serializer.Serialize(writer, value.ToString());
        }
    }
}
